package com.erp;

import java.util.HashSet;

public class HashSetTest2 {

    public static void main(String[] args) {
        HashSet<String> set = new HashSet<>();

        Thread t1 = new Thread(() -> {
            for(int i = 0; i < 10000; i++) {
                set.add(String.valueOf(i));
            }
        });
        t1.start();
        Thread t2 = new Thread(() -> {
            for(int i = 10000; i < 20000; i++) {
                set.add(String.valueOf(i));
            }
        });
        t2.start();
        try {
            t1.join();
            t2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(set.size());

    }
}
// ArrrayList --> Vector
// ArrrayList --> Vector
// HashMap --> ConcurrentHashMap
// HashMap --> Hashtable